{extend name="top/index" /}
{block name="main"}
<div class="page-content-wrapper">
        <div class="page-content" style=" min-height: 700px;">
            <!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
            <div class="modal fade" id="portlet-config" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                            <h4 class="modal-title">Modal title</h4>
                        </div>
                        <div class="modal-body">
                             Widget settings form goes here
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn blue">Save changes</button>
                            <button type="button" class="btn default" data-dismiss="modal">Close</button>
                        </div>
                    </div>
                    <!-- /.modal-content -->
                </div>
                <!-- /.modal-dialog -->
            </div>
            <!-- /.modal -->
            <!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
            <!-- BEGIN STYLE CUSTOMIZER -->
            
            <!-- END STYLE CUSTOMIZER -->
            <!-- BEGIN PAGE HEADER-->
            <div class="row">
                <div class="col-md-12">
                    <!-- BEGIN PAGE TITLE & BREADCRUMB-->
                    <h3 class="page-title">
                    角色管理 <!-- <small>view order details</small> -->
                    </h3>
                    <ul class="page-breadcrumb breadcrumb">
                        
                        <li>
                            <i class="fa fa-home"></i>
                            <a href="{:url('index/index/index')}">
                                Home
                            </a>
                            <i class="fa fa-angle-right"></i>
                        </li>
                        <li>
                            <a href="{:url('index/Role/index')}">
                                角色管理
                            </a>
                            <i class="fa fa-angle-right"></i>
                        </li>
                        
                    </ul>
                    <!-- END PAGE TITLE & BREADCRUMB-->
                </div>
            </div>
            <!-- END PAGE HEADER-->
            <!-- BEGIN PAGE CONTENT-->
               <form action="{:url('updatePower')}" method="post" >
                  <div class="form-group">
                    <label for="disabledTextInput">角色ID(不可更改)</label>
                    <input type="text" id="disabledTextInput" class="form-control" placeholder="UserName" name="id" disabled value="{$rid}">
                  </div>

                  <div class="form-group">
                        <!-- Select Basic -->
                        <label class="control-label">分配节点</label>
                        <div class="controls">
                        {if isset($list)}
                          <table class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th>
                                   ID 
                                </th>
                               
                                <th>
                                     权限
                                </th>
                                <th>
                                     排序
                                </th>
                                <th>
                                     操作
                                </th>
                            </tr>
                            </thead>
                            <tbody>
                                     {volist name="role" id="v"}

                            <tr>
                                <td>
                                        {$v.priv_id}
                                </td>
                                <td>
                                    <!-- <li style="list-style: none;">
                                        
                                        <ul> -->
                                            <input type="checkbox" name="power[]" value="{$v.priv_id}" 
                                            {if condition="in_array($v['priv_id'],$list) eq true"}checked{/if}>
                                            {$v.priv_name}
                                     <!--    </ul>
                                    </li> -->
                                </td>
                                <td>
                                        {$v.sort}
                                </td>
                                <td>
                                        <a href="{:url('role_edit', ['id'=>$v['priv_id']])}" class="btn btn-success btn">编辑</a>
                                </td>
                            </tr>
                                     {/volist}
                          
                            </tbody>
                            </table>
                          

                        {else /}
                        <table class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th>
                                   ID 
                                </th>
                                <th>
                                     权限
                                </th>
                            </tr>
                            </thead>
                            <tbody>
                                     {volist name="role" id="v"}
                            <tr>
                                <td>
                                        {$v.priv_id}
                                </td>
                                <td>
                                        <input type="checkbox" name="power[]" value="{$v.priv_id}" >
                                        {$v.priv_name}
                                </td>
                            </tr>
                                     {/volist}
                          
                            </tbody>
                            </table>
                       
                            
                        {/if}

                        </div>
                  </div>
                  <input type="hidden" name="rid" value="{$rid}">
                  <button type="submit" class="btn btn-success">提交</button>
              </form>



            </div>
    </div>
 <script>
        $(function(){
            $('.role').addClass("active");
        });
    </script>

{/block}

